package com.zzgele.qmzb.api.dao;

import com.zzgele.qmzb.api.core.Mapper;
import com.zzgele.qmzb.api.model.Bonus;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Repository
public interface BonusMapper extends Mapper<Bonus> {



//    int insert(Bonus bonus);

//    @Update("update tb_bonus set  price =#{price} ,phone=#{phone},nick_name =#{nickName},expire_time=#{expireTime},create_time=#{createTime},from_package=#{fromPackage} where id =#{id}")
//    void updateBonus(Bonus bonus);
//
//    @Delete("delete from  tb_bonus  where id =#{id}")
//    void deleteBonusById(int id);
//
    @Select("select count(*) from bonus where package_id =#{id}")
    Integer selectCurrentBonusCountByFromPackageId(Long id);
//
//    @Select("select * from tb_bonus where  from_package =#{id}")
//    @Results(value = {
//            @Result(property = "nickName", column = "nick_name"),
//            @Result(property = "expireTime", column = "expire_time"),
//            @Result(property = "createTime", column = "create_time"),
//            @Result(property = "fromPackage", column = "from_package"),
//    })
    @Select("select count(*) from bonus where package_id =#{package_id} and uid =#{uid}")
    Integer selectBonusByFromPackage(@Param("package_id") Long package_id, @Param("uid") Long uid);
//
//    @Select("select * from tb_bonus where phone =#{phone}")
//    @Results(value = {
//            @Result(property = "nickName", column = "nick_name"),
//            @Result(property = "expireTime", column = "expire_time"),
//            @Result(property = "createTime", column = "create_time"),
//            @Result(property = "fromPackage", column = "from_package"),
//    })
//    List<Bonus> selectBonusByPhone(String phone);
//
//    @Update("update tb_bonus set status = #{status} where id=#{id}")
//    void updateBonusStatus(@Param("id") int id, @Param("status") int status);
}